//
//  UIBarButtonItem+btn.m
//  MyNewWeiBo
//
//  Created by wpapple on 16/5/30.
//  Copyright © 2016年 heron. All rights reserved.
//

#import "UIBarButtonItem+btn.h"

static UIButton * _btn;

@implementation UIBarButtonItem (btn)

- (UIBarButtonItem *)itemWithImageName:(NSString *)imageName withHightImageName:(NSString *)HightImageName{
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    _btn = btn;
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:HightImageName] forState:UIControlStateHighlighted];
    btn.size = btn.currentImage.size;
    
    UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithCustomView:btn];
    return item;
}

- (void)btnClickWithTarget:(id)target with:(SEL)action{
    [_btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
}

@end
